home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-12-26 | 48.8 KB | 1,156 lines |
- Xref: bloom-picayune.mit.edu gnu.emacs.help:7400 comp.emacs:15249 news.answers:3114
- Path: bloom-picayune.mit.edu!enterpoop.mit.edu!snorkelwacker.mit.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!uwm.edu!news.bbn.com!bu.edu!bigbird!jbw
- From: jbw@bigbird.bu.edu (Joe Wells)
- Newsgroups: gnu.emacs.help,comp.emacs,news.answers
- Subject: GNU Emacs FAQ (2/5, 28-86): Common Requests/Problems
- Summary: READ BEFORE POSTING. A regularly posted list of answers to frequently
- asked questions (FAQs) about GNU Emacs and many Emacs Lisp programs.
- Contains pointers to other resources. Follow "References:" link for
- more metainfo.
- Keywords: gnu emacs faq answers frequently asked questions periodic
- Message-ID: <GNU-Emacs-FAQ-2.1992.09.22.011020@bigbird.bu.edu>
- Date: 22 Sep 92 01:10:20 GMT
- Expires: 21 Nov 92 01:10:20 GMT
- References: <GNU-Emacs-FAQ-0.1992.09.22.011020@bigbird.bu.edu>
- Sender: news@bu.edu
- Reply-To: gnu-emacs-faq-maintainers@bigbird.bu.edu
- Followup-To: poster
- Organization: GNU's Not UNIX
- Lines: 1133
- Approved: news-answers-request@mit.edu
- Supersedes: <GNU-Emacs-FAQ-2.1992.06.28.234430@bigbird.bu.edu>
-
- Archive-Name: GNU-Emacs-FAQ/part2
- Last-Modified: Mon, 21 Sep 1992 03:14:22 GMT
- Last-Posted: Tue, 22 Sep 1992 01:10:20 GMT
-
- GNU Emacs FAQ: Common Requests/Problems
-
- If you are viewing this text in a GNU Emacs Buffer, you can type "M-2 C-x $" to
- get an overview of just the questions. Then, when you want to look at the text
- of the answers, just type "C-x $".
-
- To search for a question numbered XXX, type "M-C-s ^XXX:", followed by a C-r if
- that doesn't work, then type ESC to end the search.
-
- A `+' in the 78th column means something was inserted on the line. A `-' means
- something was deleted and a `!' means some combination of insertions and
- deletions occurred.
-
- Full instructions for getting the latest FAQ are in question 22. Also see the
- `Introduction to news.answers' posting in the `news.answers' newsgroup, or send
- e-mail to `mail-server@rtfm.mit.edu' with `help' on a body line, or use FTP,
- WAIS, or Prospero to rtfm.mit.edu.
-
-
-
- Common Things People Want To Do
-
- 28: How do I set up a .emacs file properly?
-
- See `Init File' in the on-line manual.
-
- WARNING: In general, new Emacs users should not have .emacs files, because
- it causes confusing non-standard behavior. Then they send questions to
- help-gnu-emacs asking why Emacs isn't behaving as documented. :-)
-
- 29: How do I debug a .emacs file?
-
- First start Emacs with the `-q' command line option. Then, in the
- *scratch* buffer, type the following:
-
- (setq debug-on-error t) LFD
- (load-file "~/.emacs") LFD
-
- (Type LFD by pressing C-j.)
-
- If you have an error in your .emacs file, this will invoke the debugger
- when the error occurs. If you don't know how to use the debugger do
- (setq stack-trace-on-error t) instead.
-
- WARNING: this will not discover errors caused by trying to do something
- that requires the terminal/window-system initialization code to have
- been loaded. See question 127.
-
- 30: How do I make Emacs display the current line (or column) number?
-
- To find out what line of the buffer you are on right now, do "M-x
- what-line". Use "M-x goto-line" to go to a specific line. To find the
- current column number, type "M-ESC (current-column)".
-
- Typing "C-x l" will also tell you what line you are on, provided the
- buffer isn't separated into "pages" with C-l characters. In that case, it
- will only tell you what line of the current "page" you are on. WARNING:
- "C-x l" gives the wrong value when point is at the beginning of a line.
-
- There is no "correct" way to constantly display the current (or total)
- line (or column) number on the mode line in Emacs 18, or to display the
- line numbers next to the lines like vi can. Emacs is not a line-oriented
- editor, and really has no idea what "lines" of the buffer are displayed in
- the window. It would require a lot of work at the C code level to make
- Emacs keep track of this. It would not be that hard to get the column
- number, but it would still require changes at the C code level.
-
- None of the vi emulation modes provide the `set number' capability of vi
- (as far as I know).
-
- Emacs 19 will probably be able to show the line number on the mode-line,
- but probably very inefficiently.
-
- People have written various kludges to display line numbers. One is
- `display-line-numbers' by Wayne Mesard <wmesard@tofu.oracle.com,
- Mesard@bbn.com>. Look in the Lisp Code Directory. (See question
- 88.)
-
- 31: How do I turn on Abbrevs by default just in mode XXX?
-
- Put this in your .emacs file:
-
- (condition-case ()
- (read-abbrev-file nil t)
- (file-error nil))
-
- (setq XXX-mode-hook
- (function
- (lambda ()
- (setq abbrev-mode t))))
-
- 32: How do I turn on Auto-Fill mode by default?
-
- To turn on Auto-Fill mode just once for one buffer, use "M-x
- auto-fill-mode". To turn it on for every buffer in, for example, Text
- mode, do this:
-
- (setq text-mode-hook 'turn-on-auto-fill)
-
- If you want Auto-Fill mode on in all major modes, do this:
-
- (setq-default auto-fill-hook 'do-auto-fill)
-
- 33: How do I make Emacs use a certain major mode for certain files?
-
- If you want to use XXX mode for all files which end with the extension
- `.YYY', this will do it for you:
-
- (setq auto-mode-alist (cons '("\\.YYY\\'" . XXX-mode) auto-mode-alist))
-
- Otherwise put this somewhere in the first line of any file you want to
- edit in XXX mode:
-
- -*-XXX-*-
-
- 34: How do I search for, delete, or replace unprintable (8-bit or control)
- characters?
-
- To search for a single character that appears in the buffer as, for
- example, `\237', you can type "C-s C-q 2 3 7". (This assumes the value of
- search-quote-char is 17 (ie., C-q).) Searching for ALL unprintable
- characters is best done with a "regexp" search. The easiest regexp to use
- for the unprintable chars is the complement of the regexp for the
- printable chars.
-
- Regexp for the printable chars: [\t\n\r\f -~]
-
- Regexp for the unprintable chars: [^\t\n\r\f -~]
-
- To type some of these special characters in an interactive argument to
- isearch-forward-regexp or re-search-forward, you need to use C-q. (`\t',
- `\n', `\r', and `\f' stand respectively for TAB, LFD, RET, and C-l.) So,
- to search for unprintable characters using re-search-forward:
-
- M-x re-search-forward RET [^ TAB C-q LFD C-q RET C-q C-l SPC -~] RET
-
- Using isearch-forward-regexp:
-
- M-C-s [^ TAB RET C-q RET C-q C-l SPC -~]
-
- To delete all unprintable characters, simply use a replace-regexp:
-
- M-x replace-regexp RET [^ TAB C-q LFD C-q RET C-q C-l SPC -~] RET RET
-
- Replacing is similar to the above. {I need to write the text for this
- part of the answer!}
-
- Notes:
-
- * With isearch, you can type RET to get a quoted LFD (not a quoted RET).
-
- * You don't need to quote TAB with either isearch or typing something in
- the minibuffer.
-
- Here are the Emacs Lisp forms of the above regexps:
-
- ;; regexp matching all printable characters:
- "[\t\n\r\f -~]"
-
- ;; regexp matching all unprintable characters:
- "[^\t\n\r\f -~]"
-
- 35: How can I highlight a region of text in Emacs?
-
- There are ways to get highlighting (reverse video, inverse video) in GNU
- Emacs 18.58, but either they require patching the C code of Emacs and
- rebuilding, or they are slow and the highlighting disappears if you scroll
- or redraw the screen and it can not follow the point. Howard Gayle's
- patches for 8-bit output appear to allow highlighting (see question
- ^8-bit-output). Another patch for highlighting is by Kenichi Handa
- <handa@etl.go.jp>. There is a patch for use with X by Andy Norman
- <ange@hplb.hpl.hp.com> (and modified for 18.57 by Matthieu Herrb
- <matthieu@laas.fr>), which is available for FTP: !
- !
- /laas.laas.fr:pub/emacs/patch-X11-18.5{5,7} !
-
- You can highlight regions in a variety of ways in Epoch and Lucid Emacs.
- GNU Emacs 19 may not be able to just temporarily highlight a region. !
-
- Similar comments apply to displaying text in different fonts, except that
- it is even harder.
-
- 36: How do I control Emacs's case-sensitivity when searching/replacing?
-
- For searching, the value of the variable case-fold-search determines
- whether they are case sensitive:
-
- (setq case-fold-search nil) ; make searches case sensitive
- (setq case-fold-search t) ; make searches case insensitive
-
- Similarly, for replacing the variable case-replace determines whether
- replacements preserve case.
-
- To change the case sensitivity just for one major mode, use the major
- mode's hook. For example:
-
- (setq XXX-mode-hook
- (function
- (lambda ()
- (setq case-fold-search nil))))
-
- 37: How do I make Emacs wrap words for me?
-
- M-x auto-fill-mode. The default maximum line width is 74, determined by
- the variable fill-column. To find how to turn this on automatically see
- question 32.
-
- 38: Where can I get a better spelling checker for Emacs?
-
- Use Ispell. See question 119.
-
- 39: How can I spell-check TeX or *roff documents?
-
- If you want to spell-check TeX or *roff documents with Ispell, you need to
- arrange for a filter program that understands how to strip TeX or *roff
- formatting commands to be run. In the TeX distribution, there are several
- different programs named `detex', all with incompatible options, and a
- very old pair of programs named `detex' and `delatex', which should
- probably be avoided. The most useful one for Ispell is `detex' by Daniel
- Trinkle. A more recent version is available via FTP: !
- !
- /arthur.cs.purdue.edu:pub/trinkle/detex-2.3.tar.Z !
-
- Raphael Cerf <cerf@clipper.ens.fr> recently released a program for this +
- named `xetal': !
- !
- /spi.ens.fr:pub/unix/tex/ !
-
- There is a program that comes with Unix named `deroff' for stripping
- formatting commands from *roff files.
-
- Here is an example of code you can put in a .emacs file to use these
- programs:
-
- ;; Based on suggestions by David G. Grubbs <dgg@ksr.com> and Paul Palmer
- ;; <palmerp@math.orst.edu>.
-
- ;; Assuming the use of detex 2.3 by Daniel Trinkle:
- ;; -w means one word per line.
- ;; -n means don't expand \input or \include commands.
- ;; -l means force LaTeX mode.
-
- (require 'ispell) ; for the make-variable-buffer-local statements
- (setq plain-TeX-mode-hook
- (function
- (lambda ()
- (setq ispell-filter-hook "detex")
- (setq ispell-filter-hook-args '("-nw")))))
- (setq LaTeX-mode-hook
- (function
- (lambda ()
- (setq ispell-filter-hook "detex")
- (setq ispell-filter-hook-args '("-lnw")))))
- (setq nroff-mode-hook
- (function
- (lambda ()
- (setq ispell-filter-hook "deroff")
- (setq ispell-filter-hook-args '("-w")))))
-
- You will have to adjust the arguments for programs other than Trinkle's
- detex or for other versions of deroff. Experiment running the command
- from the shell to find the correct options. If you don't have a filter
- that knows how to output one word per line, you must pipe its output
- through another filter to break up the output.
-
- 40: How do I change load-path?
-
- In general, you should only *add* to the load-path. You can add
- directory /XXX/YYY to the load path like this:
-
- (setq load-path (append load-path '("/XXX/YYY/")))
-
- To do this relative to your home directory:
-
- (setq load-path (append load-path (list (expand-file-name "~/YYY/"))))
-
- 41: How do I use an already running Emacs from another window?
-
- The `emacsclient' program is for editing a file using an already running
- Emacs rather than starting up a new Emacs. It does this by sending a
- request to the already running Emacs, which must be expecting the request.
-
- * Setup
-
- Emacs must have executed the `server-start' function for emacsclient to
- work. This can be done either by a command line option:
-
- emacs -f server-start
-
- or by invoking server-start from the .emacs file:
-
- (if (some conditions are met) (server-start))
-
- When this is done, Emacs starts a subprocess running a program called
- `server'. `server' creates a Unix domain socket in the user's home
- directory named `.emacs_server'.
-
- To get your news reader, mail reader, etc., to invoke emacsclient, try
- setting the environment variable EDITOR (or sometimes VISUAL) to the
- value `emacsclient'. You may have to specify the full pathname of the
- emacsclient program instead. Examples:
-
- # csh commands:
- setenv EDITOR emacsclient
- setenv EDITOR /usr/local/emacs/etc/emacsclient # using full pathname
-
- # sh command:
- EDITOR=emacsclient export EDITOR
-
- * Normal use
-
- When emacsclient is run, it connects to the `.emacs_server' socket and
- passes its command line options to `server'. When `server' receives
- these requests, it sends this information on the the Emacs process,
- which at the next opportunity will visit the files specified. (Line
- numbers can be specified just like with Emacs.) The user will have to
- switch to the Emacs window by hand. When the user is done editing a
- file, the user can type "C-x #" to indicate this. This will switch to
- another buffer created at the request of emacsclient if there are any.
- When "C-x #" has been invoked on all of the files that the emacsclient
- requested to be edited, Emacs will send notification of this to `server'
- which will pass this on to the emacsclient, which will then exit.
-
- NOTE: `emacsclient' and `server' must be running on machines which share
- the same filesystem for this to work. The pathnames that emacsclient
- specifies should be correct for the filesystem that the Emacs process
- sees. The Emacs process should not be suspended at the time emacsclient
- is invoked. emacsclient should either be invoked from another X window or
- from a shell window inside Emacs itself.
-
- There is an enhanced version of emacsclient/server called `gnuserv' by
- Andy Norman <ange@hplb.hpl.hp.com> which is available in the Emacs Lisp
- Archive. gnuserv uses Internet domain sockets, so it can work across most
- network connections. It also supports the execution of arbitrary Emacs
- Lisp forms and also does not require the client program to wait for
- completion. It is available via anonymous FTP (Emacs Lisp Archive:
- packages/gnuserv.shar).
-
- 42: How do I make Emacs recognize my compiler's funny error messages?
-
- Write a program which runs the compiler as a child and filters its output,
- rearranging as necessary. Install with same name as compiler somewhere in
- path.
-
- Keith Moore <moore@cs.utk.edu> wrote one such for a C compiler under AIX.
- Available via FTP: !
- !
- /cs.utk.edu:readonly/aixcc.lex !
-
- Jim Frost <jimf@saber.com> wrote another for the IBM xlc compiler on the
- RS/6000. (I don't know if these are both for the same compiler.)
- Johnathan Vail <vail@tegra.COM> wrote something for a High C compiler
- (`hc', which is one of the compilers on the RS/6000, although I think
- Johnathan wrote his program for hc on a different computer).
-
- 43: How do I indent switch statements like this?
-
- Many people want to indent their switch statements like this:
-
- f()
- {
- switch(x) {
- case A:
- x1;
- break;
- case B:
- x2;
- break;
- default:
- x3;
- }
- }
-
- I don't believe there is any way to do this exactly without modifying the
- Lisp code in c-mode.el. You can set c-indent-level to 4 and
- c-label-offset to -2, but this has bad effects elsewhere. {Anyone have a
- solution?}
-
- 44: How can I make Emacs automatically scroll horizontally?
-
- There is no completely correct way of doing this that does not involve !
- rewriting all commands or writing your own top-level command loop (not a !
- completely bad idea). Wayne Mesard <wmesard@pescadero.stanford.edu> has !
- written a particularly advanced kludge called `hscroll.el' that checks !
- once a second to make sure point is visible. !
-
- 45: How do I make Emacs "typeover" or "overwrite" instead of inserting?
-
- M-x overwrite-mode (a minor mode).
-
- 46: How do I stop Emacs from beeping on a terminal?
-
- Martin R. Frank <martin@cc.gatech.edu> writes:
-
- Tell Emacs to use the 'visible bell' instead of the audible bell, and
- set the visible bell to nothing.
-
- Put this in your TERMCAP environment variable:
-
- ... :vb=: ...
-
- And evaluate this:
-
- (setq visible-bell t)
-
- 47: How do I turn down the bell volume in Emacs running under X Windows?
-
- Under versions of Emacs before 18.58, the bell volume was annoying loud
- and difficult to turn off. So upgrading to 18.58 will reduce the volume.
- If you want to turn it off completely, use `xset'. There is no way to
- turn the bell off just for Emacs without affecting all other programs.
-
- Under Epoch you can do:
-
- (setq epoch::bell-volume 20)
-
- Stu Grossman <grossman@sunburn.stanford.edu> wrote a patch that allows the
- bell volume to be adjusted from inside Emacs just for Emacs.
-
- 48: How do I tell Emacs to automatically indent a new line to the
- indentation of the previous line?
-
- One solution is Indented Text Mode (M-x indented-text-mode).
-
- If you have Auto-Fill mode on (a minor mode, see question 32), you can
- tell Emacs to prefix every line with a certain character sequence, the
- "fill prefix". Type the prefix at the beginning of a line, position point
- after it, and then type "C-x ." (set-fill-prefix) to set the fill prefix.
- Thereafter, auto-filling will automatically put the fill prefix at the
- beginning of new lines, and M-q (fill-paragraph) will maintain any fill
- prefix when refilling the paragraph.
-
- NOTE: If you have paragraphs with different levels of indentation, you
- will have to set the fill prefix to the correct value each time you move
- to a new paragraph. To avoid this hassle, try one of the many packages
- available from the Emacs Lisp Archive. Look up `fill' and `indent' in the
- Lisp Code Directory for guidance.
-
- 49: How do I show which parenthesis matches the one I'm looking at?
-
- If you're looking at a right parenthesis (or brace or bracket) you can
- delete it and reinsert it. Emacs will blink the cursor on the matching
- parenthesis.
-
- M-C-f (forward-sexp) and M-C-b (backward-sexp) will skip over balanced
- parentheses, so you can see which parentheses match. (You can train it to
- skip over balanced brackets and braces at the same time by modifying the
- syntax table.)
-
- Here is some Emacs Lisp that will make the % key show the matching
- parenthesis, like in vi. In addition, if the cursor isn't over a
- parenthesis, it simply inserts a % like normal.
-
- ;; By an unknown contributor
-
- (global-set-key "%" 'match-paren)
-
- (defun match-paren (arg)
- "Go to the matching parenthesis if on parenthesis otherwise insert %."
- (interactive "p")
- (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
- ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
- (t (self-insert-command (or arg 1)))))
-
- 50: In C mode, can I show just the lines that will be left after #ifdef
- commands are handled by the compiler?
-
- M-x hide-ifdef-mode. (This is a minor mode.)
-
- You may have to (load "hideif") first. If you want to do this regularly,
- put this in your .emacs file:
-
- (autoload 'hide-ifdef-mode "hideif" nil t)
-
- {Yes, I know, this should be in lisp/loaddefs.el already.}
-
- 51: Is there an equivalent to the `.' (dot) command of vi?
-
- (`.' is the redo command in vi. It redoes the last insertion/deletion.)
-
- No, not really.
-
- You can type "C-x ESC" (repeat-complex-command) to reinvoke commands that
- used the minibuffer to get arguments. In repeat-complex-command you can
- type M-p and M-n to scan through all the different complex commands you've
- typed.
-
- To repeat something on each line I recommend using keyboard macros.
-
- 52: What are the valid X resource settings (ie., stuff in .Xdefaults)?
-
- See the Emacs man page, or the etc/OPTIONS file. Ignore the information
- in etc/XDOC which is way out of date.
-
- 53: How do I execute a piece of Emacs Lisp code?
-
- There are a number of ways to execute (called "evaluate") an Emacs Lisp
- "form":
-
- * If you want it evaluated every time you run Emacs, put it in a file
- named `.emacs' in your home directory.
-
- * You can type the form in the *scratch* buffer, and then type LFD (or
- C-j) after it. The result of evaluating the form will be inserted in
- the buffer.
-
- * In Emacs-Lisp mode, typing M-C-x evaluates a top-level form before or
- around point.
-
- * Typing "C-x C-e" in any buffer evaluates the Lisp form immediately
- before point and prints its value in the echo area.
-
- * Typing M-ESC or M-x eval-expression allows you to type a Lisp form in
- the minibuffer which will be evaluated.
-
- * You can use M-x load-file to have Emacs evaluate all the Lisp forms in
- a file. (To do this from Lisp use the function `load' instead.)
-
- These functions are also used for evaluating Lisp forms:
-
- load-library, eval-region, eval-current-buffer, require, autoload
-
- 54: How do I change Emacs's idea of the tab character's length?
-
- Example: (setq default-tab-width 10).
-
- 55: How do I insert `>' at the beginning of every line?
-
- Type "M-x replace-regexp RET ^ RET > RET".
-
- To do this only in the region, type "C-x n M-x replace-regexp RET ^ RET
- > RET C-x w".
-
- WARNING: The command narrow-to-region (C-x n) is disabled by default
- because it can be very confusing (ie., "Oh no! Where did my file go?").
-
- 56: How do I insert `_^H' before each character in a paragraph to get an
- underlined paragraph?
-
- M-x underline-region.
-
- 57: How do I repeat a command as many times as possible?
-
- Use "C-x (" and "C-x )" to make a keyboard macro that invokes the command
- and then type "M-0 C-x e".
-
- WARNING: any messages your command prints in the echo area will be
- suppressed.
-
- 58: How do I make Emacs behave like this: when I go up or down, the cursor
- should stay in the same column even if the line is too short?
-
- M-x picture-mode. (This is a minor mode, in theory anyway ...)
-
- 59: How do I tell Emacs to iconify itself?
-
- You need to modify C source and recompile. Either that or get Epoch or
- Lucid Emacs instead. Patches have been written by Robert Forsman
- <thoth@reef.cis.ufl.edu> and Johan Vromans <jv@mh.nl> to allow Emacs to
- iconify itself and by Matt Wette <mwette@mr-ed.jpl.nasa.gov> and
- Manavendra K. Thakur <thakur@zerkalo.harvard.edu> (for 18.57, plus icon
- geometry) to allow Emacs to start up iconified. I don't know which of
- these patches work together.
-
- Anonymous FTP:
- /csi.jpl.nasa.gov:pub/emacs.patch1 (Matt Wette) +
- /ftp.eu.net:gnu/emacs/FP-Xfun.Z (Johan Vromans) +
- /ftp.urc.tue.nl:pub/tex/emacs/FP-Xfun (Johan Vromans) +
-
- 60: How do I use regexps (regular expressions) in Emacs?
-
- See `Regexps' in the online manual.
-
- WARNING: The "or" operator is `\|', not `|', and the grouping operators
- are `\(' and `\)'. Also, the string syntax for a backslash is "\\".
- Thus, the string syntax for a regular expression like xxx\(foo\|bar\) is
- "xxx\\(foo\\|bar\\)". Notice the duplicated backslashes!
-
- WARNING: Unlike in Unix grep, sed, etc., a complement character set
- ([^...]) can match a newline character (LFD aka C-j aka \n), unless
- newline is mentioned as one of the characters not to match.
-
- WARNING: The character syntax regexps (eg. `\sw') are not meaningful
- inside character set regexps (eg. `[aeiou]'). (This is actually typical
- for regexp syntax.)
-
- 61: How do I perform a replace operation across more than one file?
-
- The "tags" feature of Emacs includes the command tags-query-replace which
- performs a query-replace across all the files mentioned in the TAGS file.
- See `Tags:Tags Search' in the online manual.
-
- In addition, Martin Boyer has written a package named global-replace which
- will perform a query-replace across all the files mentioned in the
- *compilation* buffer (usually done after a `grep'), which is available via
- anonymous FTP: !
- !
- /ireq-robot.hydro.qc.ca:pub/emacs/lisp/compile.el.Z !
- /ireq-robot.hydro.qc.ca:pub/emacs/lisp/global-replace.el.Z !
- /ireq-robot.hydro.qc.ca:pub/emacs/lisp/query.el.Z !
-
- 62: Where is the documentation for `etags'?
-
- `etags' takes options just like a prior version of ctags, so your ctags
- manual (if any) may be useful. {Can someone send me the details on this?}
-
-
-
- Bugs/Problems
-
- 63: Does Emacs have problems with files larger than 8 megabytes?
-
- Most installed versions of GNU Emacs will use 24-bit signed integers (and
- 24-bit pointers) internally. This limits the file size that Emacs can
- handle to 8,388,607 bytes (2^23 - 1).
-
- Leonard N. Zubkoff <lnz@lucid.com> suggests putting the following two
- lines in src/config.h before compiling Emacs to allow for 26-bit integers
- and pointers (and thus filesizes of up to 33,554,431 bytes):
-
- #define VALBITS 26
- #define GCTYPEBITS 5
-
- WARNING: This method may result in `ILLEGAL DATATYPE' and other random
- errors on some machines.
-
- David Gillespie <daveg@csvax.cs.caltech.edu> gives an explanation of why
- Emacs uses 24 bit integers and pointers:
-
- Emacs is largely written in a dialect of Lisp; Lisp is a freely-typed
- language in the sense that you can put any value of any type into any
- variable, or return it from a function, and so on. So each value must
- carry a "tag" along with it identifying what kind of thing it is, eg.,
- integer, pointer to a list, pointer to an editing buffer, and so on.
- Emacs uses standard 32-bit integers for data objects, taking the top 8
- bits for the tag and the bottom 24 bits for the value. So integers (and
- pointers) are somewhat restricted compared to true C integers and
- pointers.
-
- Emacs uses 8-bit tags because that's a little faster on byte-oriented
- machines, but there are only really enough tags to require 6 bits.
-
- 64: Why can't Emacs find files in current directory on startup?
-
- Most likely, you have an environment variable named PWD that is set to a
- value other than the name of your current directory. This is most
- likely caused by using two different shell programs. `ksh' and (some
- versions of) `csh' set and maintain the value of the PWD environment
- variable, but `sh' doesn't. If you start sh from ksh, change your
- current directory inside sh, and then start Emacs from inside sh, PWD
- will have the wrong value but Emacs will use this value. See the
- etc/OPTIONS file for more details.
-
- Perhaps an easier solution is not to use two shells. The `chsh' program
- can often be used to change one's default login shell.
-
- You may have PWD set for other reasons. Another possibility is that you
- are setting default-directory from your .emacs file.
-
- Here is a fix by Jim Blandy <jimb@occs.cs.oberlin.edu>:
-
- >--- emacs/jjj/emacs-18.58/lisp/startup.el Tue Jan 15 23:19:04 1991
- >+++ startup.el Mon Apr 20 00:21:01 1992
- >@@ -81,5 +81,7 @@
- > ;; In presence of symlinks, switch to cleaner form of default directory.
- > (if (and (not (eq system-type 'vax-vms))
- >- (getenv "PWD"))
- >+ (getenv "PWD")
- >+ (equal (nthcdr 10 (file-attributes default-directory))
- >+ (nthcdr 10 (file-attributes (getenv "PWD")))))
- > (setq default-directory (file-name-as-directory (getenv "PWD"))))
- > (unwind-protect
-
- 65: How do I get rid of the ^M junk in my Shell buffer?
-
- For tcsh, put this in your `.cshrc' (or `.tcshrc') file:
-
- if ($?EMACS) then
- if ("$EMACS" == t) then
- if ($?tcsh) unset edit
- stty nl
- endif
- endif
-
- Or put this in your .emacs_tcsh file:
-
- unset edit
- stty nl
-
- Alternatively, use csh in your Shell buffers instead of tcsh. One way
- is:
-
- (setq explicit-shell-file-name "/bin/csh")
-
- and another is to do this in your .cshrc (or .tcshrc) file:
-
- setenv ESHELL /bin/csh
-
- (You must start Emacs over again with the environment variable properly
- set for this to take effect.)
-
- 66: Why do I get `Process shell exited abnormally with code 1'?
-
- The most likely reason for this message is that the `env' program is not
- properly installed. This program should be compiled (for the correct
- architecture!) and installed with execute permission for everyone in
- Emacs's program directory, which is normally /usr/local/emacs/etc. You
- can find what this directory is at your site by inspecting the value of
- the variable exec-directory by typing "C-h v exec-directory RET". `env'
- should also be for the correct architecture (check using `file' command).
-
- You should also check for other programs named `env' in your path (eg.,
- SunOS has a program named /usr/bin/env). I don't understand why this can
- cause a failure and I don't know a general solution for working around the
- problem in this case.
-
- The `make clean' command will remove `env' and other vital programs, so be
- careful when using it.
-
- It has been reported that this sometimes happened when Emacs was started
- as an X client from an xterm window (ie. had a controlling tty) but the
- xterm was later terminated.
-
- See also etc/PROBLEMS for other possible causes of this message.
-
- 67: Why can't I cut from Emacs and paste in other X programs?
-
- Emacs stores things you "cut" in the X "cut buffers". It also pastes from
- the cut buffer `CUT_BUFFER0'. This is obsolete. Most modern X programs
- now expect to work with "selections" instead of cut buffers, although some
- like `xterm' will try to use the cut buffers if the selection is null.
-
- Emacs 18.58 contains a "fix" that makes xterm work by default. This
- "fix" is that Emacs clears the `PRIMARY' selection when it stores
- something in the cut buffer. By making the selection null, xterm will
- then fetch from the cut buffer when you try to paste.
-
- For versions of Emacs prior to 18.58, you can make pasting from Emacs into
- xterm work with the following X resources:
-
- ! Solution by Thomas Narten, should work under X11R3 and later GNU
- ! Emacs only copies to CUT_BUFFER0. xterm by default wants to paste
- ! from the PRIMARY selection.
- XTerm*VT100.Translations: #override \
- ~Meta <Btn2Up>: insert-selection(CUT_BUFFER0,PRIMARY)
-
- You may have problems copying between Emacs and programs other than xterm
- that won't store cut text in the cut buffers or look in the cut buffers
- for text to paste (for backwards compatibility with obsolete applications
- like Emacs :-). The best workaround is to use the `xcutsel' program as an
- intermediary. -
-
- This problem does not exist for Epoch or Lucid Emacs.
-
- 68: Where is the termcap/terminfo entry for terminal type `emacs'?
-
- The termcap entry for terminal type `emacs' is ordinarily put in the
- TERMCAP environment variable of subshells. It may help in certain
- situations (eg., using rlogin from shell buffer) to add an entry for
- `emacs' to the system-wide termcap file. Here is a correct termcap entry
- for `emacs':
-
- emacs:tc=unknown:
-
- To make a terminfo entry for `emacs', use `tic' or `captoinfo'. You need
- to generate /usr/lib/terminfo/e/emacs. It may work to simply copy
- /usr/lib/terminfo/d/dumb to /usr/lib/terminfo/e/emacs.
-
- Having a termcap/terminfo entry will not enable the use of full screen
- programs in shell buffers. Use M-x terminal-emulator for that instead.
-
- A workaround to the problem of missing termcap/terminfo entries is to
- change terminal type `emacs' to type `dumb' or `unknown' in your shell
- start up file. `csh' users could put this in their .cshrc files:
-
- if ("$term" == emacs) set term=dumb
-
- 69: Why does Emacs spontaneously start displaying `I-search:' and beeping?
-
- Your terminal (or something between your terminal and the computer) is
- sending C-s and C-q for flow control, and Emacs is receiving these
- characters and interpreting them as commands. (The C-s character normally
- invokes the isearch-forward command.) For possible solutions, see
- question 131.
-
- 70: Why can't Emacs talk to certain hosts (or certain hostnames)?
-
- The problem may be that Emacs is linked with a wimpier version of
- gethostbyname than the rest of the programs on the machine. This is often
- manifested as a message on startup of `X server not responding. Check
- your DISPLAY environment variable.' or a message of `Unknown host' from
- open-network-stream.
-
- On a Sun, this may be because Emacs had to be linked with the static C
- library. The version of gethostbyname in the static C library may only
- look in /etc/hosts and the NIS (YP) maps, while the version in the dynamic
- C library may be smart enough to check DNS in addition to or instead of
- NIS. On a Motorola Delta running System V R3.6, the version of
- gethosbyname in the standard library works, but the one that works with
- NIS doesn't (the one you get with -linet). Other operating systems have
- similar problems.
-
- Try these options:
-
- * Explicitly add the host you want to communicate with to /etc/hosts.
-
- * Relink Emacs with this line in src/config.h:
-
- #define LIBS_SYSTEM -lresolv
-
- * Replace gethostbyname and friends in libc.a with more useful versions
- such as the ones in libresolv.a. Then relink Emacs.
-
- * If you are actually running NIS, make sure that `ypbind' is properly
- told to do DNS lookups with the correct command line switch.
-
- * Use tcp.el and tcp.c from GNUS. This has the additional advantage that
- you can use numeric IP addresses instead of names. open-network-stream
- currently can't handle numeric addresses. Brian Thomson
- <thomson@hub.toronto.edu> has a enhancement to open-network-stream to
- allow it to handle numeric addresses.
-
- 71: Why does Emacs say `Error in init file'?
-
- An error occurred while loading either your .emacs file or the system-wide
- lisp/default.el file. For information on how to debug your .emacs file,
- see question 29.
-
- It may be the case that you may need to load some package first, or use a
- hook that will be evaluated after the package is loaded. A common case of
- this is explained in question 127.
-
- 72: Why does Emacs ignore my X resources (my .Xdefaults file)?
-
- * Try compiling Emacs with the XBACKWARDS macro defined. There is a bug
- in some implementations of XGetDefault, which do not correspond to the
- documentation or the header files.
-
- * Make sure you are either using the class name of `Emacs' (oops,
- apparently this is buggy in Emacs 18.58!) or the correct instance name.
- The instance name is normally the same as the name of the file Emacs is
- in (ie., the last part of argv[0]), but this can be overridden by -rn
- command line option or the WM_RES_NAME environment variable.
-
- WARNING: Reports say using the class name fails in Emacs 18.58.
-
- WARNING: The advice the man page gives to use `emacs' is often wrong.
-
- WARNING: Older versions of Emacs got the class name wrong.
-
- * Emacs currently ignores the -xrm command line argument.
-
- * Emacs does not yet handle X11R5 screen-specific resources.
-
- * Emacs has a bug where it ignores color specifications if running on a
- 1-bit display (ie. a non-color display).
-
- * I don't think Emacs will use either of the application-specific resource
- files. Thus these environment variables don't affect it: XAPPLRESDIR,
- XUSERFILESEARCHPATH, XFILESEARCHPATH. {Correct?}
-
- 73: Why does Emacs take 20 seconds to visit a file?
-
- The usual cause is that the master lock file, `!!!SuperLock!!!' has been
- left in the lock directory somehow. Delete it.
-
- Mark Meuer <meuer@geom.umn.edu> says that NeXT NFS has a bug where an
- exclusive create succeeds but returns an error status. This can cause the
- same problem. Since Emacs's file locking doesn't work over NFS anyway,
- the best solution is to recompile Emacs with CLASH_DETECTION undefined.
-
- 74: How do I edit a file with a `$' in its name?
-
- When entering a filename in the minibuffer, Emacs will attempt to expand
- a `$' followed by a word as an environment variable. To suppress this
- behavior, type "$$" instead.
-
- 75: Why does Shell mode lose track of the shell's current directory?
-
- Emacs has no way of knowing when the shell actually changes its directory.
- This is an intrinsic limitation of Unix. So it tries to guess by
- recognizing `cd' commands. If you type `cd' followed by a directory name
- with a variable reference (`cd $HOME/bin') or with a shell metacharacter
- (`cd ../lib*'), Emacs will fail to correctly guess the shell's new current
- directory. A huge variety of fixes and enhancements to Shell mode for
- this problem have been written to handle this problem. Check the Lisp
- Code Directory (see question 88).
-
- 76: Why doesn't my change to load-path work?
-
- If you added a directory name containing a tilde (~) to your load-path,
- expecting the tilde to be interpreted as your home directory, then you
- need to do something like this:
-
- (setq load-path (mapcar 'expand-file-name load-path))
-
- 77: Why does the cursor always go to the wrong column when I move up or
- down one line?
-
- You have inadvertently typed "C-x C-n" (set-goal-column) which sets the
- "goal column" to the column where the cursor was. To undo this type
- "C-u C-x C-n".
-
- If you make this mistake frequently, you might want to unbind or disable
- this command by doing one of these two:
-
- (define-key ctl-x-map "\C-n" nil)
- (put 'set-goal-column 'disabled t)
-
- 78: Why does Emacs hang with message `Unknown XMenu error' with X11R4?
-
- Many different X errors can produce this message. Here is the solution
- to one problem:
-
- X11 Release 4 (and later, including OpenWindows) enforces some conditions
- in the X protocol that were previously allowed to pass unnoticed. You
- need to put the X11R4 server into X11R3 bug compatibility mode for Emacs's
- Xmenu code to work. You can do this with the command `xset bc'.
-
- 79: Why doesn't display-time show the load average in the mode line
- anymore?
-
- In GNU Emacs 18.56, a change was made in the display-time code.
- Formerly, in version 18.55, Emacs used a program named `loadst' to
- notify Emacs of the change in time every minute. loadst also sent Emacs
- the system load average if it was installed with sufficient privilege to
- get that information (or was on a system where no such privilege was
- needed). Emacs then displayed this information in the mode line.
-
- In version 18.56, this code was changed to use a program named `wakeup'.
- wakeup doesn't send Emacs any information, it's only purpose is to send
- Emacs *something* every minute, thus invoking the filter function in
- Emacs once a minute. The filter function in Emacs does all the work of
- finding the time, date, and load average. However, getting the load
- average requires the privilege to read kernel memory on most systems.
- Since giving Emacs this privilege would destroy any security a system
- might have, for almost everyone this is not an option. In addition,
- Emacs does not have the code built into it to get this information on
- the systems which have special system calls for this purpose, even
- though loadst had code for this.
-
- The solution I use is to get the files lisp/display-time.el and
- etc/loadst.c from version 18.55 and use those with 18.58. (I have heard
- a rumor that loadst disappeared because of the legal action Unipress
- threatened against IBM.)
-
- WARNING: Do not install Emacs setgid kmem unless you wish to destroy
- any security your system might have!!!!!!!!!!
-
- If you are using Emacs 18.55 or earlier, or already using the solution I
- describe above, read further:
-
- The most likely cause of the problem is that `loadst' can't read the
- special file /dev/kmem. To properly install loadst, it should be either
- setuid to the owner of /dev/kmem, or is should be setgid to the group to
- which /dev/kmem belongs. In either case, /dev/kmem should be readable by
- its owner or its group, respectively. Assuming the existence of a group
- named `kmem', here is an example of how to do this:
-
- chgrp kmem /dev/kmem
- chmod g+r /dev/kmem
- chgrp kmem /usr/local/emacs/etc/loadst
- chmod g+s /usr/local/emacs/etc/loadst
-
- Another possibility is that your version of Unix doesn't have the load
- average data available in /dev/kmem. Your version of Unix might have a
- special system call to retrieve this information (eg., inq_stats under
- UMAX), and loadst might not have been enhanced to cope with this.
-
- 80: Why does ispell sometimes ignore the local dictionary?
-
- You need to update the version of Ispell to 2.0.02. (Or you can switch to
- version 3.0 which is still in beta-testing.) A patch is available via
- anonymous FTP: !
- !
- /archive.cis.ohio-state.edu:pub/gnu/ispell/patch2.Z !
-
- You also need to change a line in ispell.el from:
-
- (defconst ispell-version "2.0.01") ; Check against output of "ispell -v".
-
- to:
-
- (defconst ispell-version "2.0.02") ; Check against output of "ispell -v".
-
- 81: Why does Ispell treat each line as a single word?
-
- Ispell expects to get its input one word per line. The ispell filter,
- which is specified by the variables ispell-filter-hook and
- ispell-filter-hook-args, should output at most one word per line.
-
- 82: Are there any security risks in GNU Emacs?
-
- * the `movemail' incident (No, this is not a risk.)
-
- Cliff Stoll in his book `The Cuckoo's Egg' describes this in chapter 4.
- The site at LBL had installed the `etc/movemail' program setuid root.
- Since `movemail' had not been designed for this situation, a security
- hole was created and users could get root priveleges.
-
- `movemail' has since been changed so that even if it is installed setuid
- root this security hole will not be a result.
-
- I have heard unverified reports that the Internet worm took advantage of
- this configuration problem.
-
- * the file-local-variable feature (Yes, a risk, but easy to change.)
-
- There is an Emacs feature that allows the setting of local values for
- variables when editing a file by including specially formatted text near
- the end of the file. This feature also includes the ability to have
- arbitrary Emacs Lisp code evaluated when the file is visited.
- Obviously, there is a potential for Trojan horses to exploit this
- feature.
-
- If you set the variable inhibit-local-variables to a non-nil value,
- Emacs will display the special local variable settings of a file that
- you visit and ask you if you really want them. This variable is not
- mentioned in the manual.
-
- It is wise to do this in lisp/site-init.el before building Emacs:
-
- (setq inhibit-local-variables t)
-
- If Emacs has already been built, the expression can be put in
- lisp/default.el instead, or an individual can put it in their own .emacs
- file.
-
- The ability to exploit this feature by sending e-mail to an RMAIL user
- was fixed sometime after Emacs 18.52. However, any new package that
- uses find-file or find-file-noselect has to be careful about this.
-
- For more information, see `File Variables' in the online manual (which,
- incidentally, does not describe how to disable the feature).
-
- There is a new variable in Emacs 18.58 named ignore-local-eval which
- turns out to be useless as currently implemented. Ignore it.
-
- * synthetic X events (Yes, a risk, use MIT-MAGIC-COOKIE-1 or better.)
-
- Emacs accepts synthetic X events generated by the SendEvent request as
- though they were regular events. As a result, if you are using the
- trivial host-based authentication, other users who can open X
- connections to your X workstatation can make your Emacs process do
- anything, including run other processes with your priveleges.
-
- The only fix for this is to prevent other users from being able to open
- X connections. The standard way to prevent this is to use a real
- authentication mechanism, such as MIT-MAGIC-COOKIE-1. If using the
- `xauth' program has any effect, then you are probably using
- MIT-MAGIC-COOKIE-1. Your site may be using a superior authentication
- method; ask your system administrator.
-
- If real authentication is not a possibility, you may be satisfied by
- just allowing hosts access for brief intervals while you start your X
- programs, then removing the access. This reduces the risk somewhat by
- narrowing the time window when hostile users would have access, but DOES
- NOT ELIMINATE THE RISK.
-
- Lucid GNU Emacs does not accept synthetic X events unless you set a +
- variable. +
-
- * autosave file permissions (Yes, a risk, hard to work around.)
-
- The file permissions for autosave files are determined solely by the
- Emacs process's `umask' value. The permissions of the file being
- autosaved are not used. The easiest workaround is to keep sensitive
- files in protected directories. Sebastian Kremer has written an
- enhanced version of the autosave file name picking code that can avoid
- this problem by keeping autosave files in a protected directory. {FTP
- information please?} This problem will be fixed in Emacs 19.
-
-
-
- Difficulties Building/Installing/Porting Emacs
-
- 83: What should I do if I have trouble building Emacs?
-
- First look in the file etc/PROBLEMS to see if there is already a solution
- for your problem. Next check the FAQ (you're reading it). If you don't
- find a solution, then report your problem via e-mail to
- bug-gnu-emacs@prep.ai.mit.edu. Please do not post it to gnu.emacs.help or
- e-mail it to help-gnu-emacs@prep.ai.mit.edu. For further guidelines, see
- question 8.
-
- 84: How do I stop Emacs from failing when the executable is stripped?
-
- Don't do that.
-
- This problem has been reported on SGI Indigo machines running Irix 4.0.*
- and RS/6000 machines. Scott Henry <scotth@hoshi.corp.SGi.COM> posted a
- patch that fixes the problem for Irix.
-
- 85: Why does linking Emacs with -lX11 fail? !
- !
- Emacs needs to be linked with the static version of the X11 library, !
- libX11.a. This may be missing. !
- !
- Under OpenWindows, you may need to use `add_services' to add the !
- `OpenWindows Programmers' optional software category from the CD-ROM. -
-
- Under HP-UX 8.0, you may need to run `update' again to load the -
- X11-PRG `fileset'. This may be missing even if you specified `all
- filesets' the first time. If libcurses.a is missing, you may need to load
- the `Berkeley Development Option' {???}.
-
- If you are building the MIT X11 sources, you may need to modify your +
- `site.cf' file to get static versions of the libraries. (Info from David +
- Zuhn <zoo@cygnus.com>.) +
- +
- Other systems may have similar problems. You can always define +
- CANNOT_DUMP and link with the shared libraries instead.
-
- To get the Xmenu stuff to work, you need to find a copy of MIT's +
- liboldX.a. +
-
- 86: Why does Emacs 18.55 say `Fatal error (6).Abort' under SunOS 4.1?
-
- I had hoped this question would go away after Emacs 18.57 was released,
- but people continue to compile 18.55. Easiest solution: upgrade.
-
- This is a result of the SunOS localtime/tzsetwall malloc bug, which was
- (finally!) fixed in SunOS 4.1.2. If you actually need the full
- explanation, send me e-mail. If you absolutely must compile Emacs 18.55
- (eg., you are compiling Nemacs), the easiest workaround was to put
- `#define SYSTEM_MALLOC' in src/config.h. -
-
-
-
-